using System.Threading;
using Avalonia.Controls;
using Avalonia.Input;
using SocketTool.Controls;

namespace SocketTool.Views
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            App.MainWindow = this;
            var growlParent = this.FindControl<StackPanel>("GrowlParentPanel");
            GrowlControl.SetParentStack(growlParent);
        }

        /// <summary>
        /// 鼠标双击全屏和取消全屏
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InputElement_OnPointerPressed(object? sender, PointerPressedEventArgs e)
        {
            if (e.ClickCount == 2)
            {
                if (this.WindowState == WindowState.Maximized)
                    this.WindowState = WindowState.Normal;
                else
                    this.WindowState = WindowState.Maximized;
                return;
            }

            //直接调用窗口的句柄实现拖拽, 和Windows下的WPF开发不同，窗口拖拽给的参数居然是鼠标点击事的事件
            this.PlatformImpl.BeginMoveDrag(e);
        }
        
    }
}